package io.qar.feign;

import io.qar.commons.tools.constant.ServiceConstant;
import io.qar.commons.tools.utils.Result;
import io.qar.commons.tools.validator.ValidatorUtils;
import io.qar.commons.tools.validator.group.AddGroup;
import io.qar.commons.tools.validator.group.DefaultGroup;
import io.qar.commons.tools.validator.group.UpdateGroup;
import io.qar.dto.ScheduleJobDTO;
import io.qar.feign.fallback.ScheduleJobFeignClientFallbackFactory;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 执行回算任务
 */
@FeignClient(name = ServiceConstant.QAR_JOB_SERVER, contextId = "ScheduleJobFeignClient", fallbackFactory = ScheduleJobFeignClientFallbackFactory.class)
public interface ScheduleJobFeignClient {

    @PostMapping("job/schedule/createResume")
    Result createResume(@RequestBody ScheduleJobDTO dto);

    @GetMapping("job/schedule/{id}")
    Result<ScheduleJobDTO> info(@PathVariable("id") Long id);


    /**
     * 任务保存
     * @param dto
     * @return
     */
    @PostMapping("job/schedule")
    Result save(@RequestBody ScheduleJobDTO dto);

    /**
     * 任务更新
     * @param dto
     * @return
     */
    @PutMapping("job/schedule")
    Result update(@RequestBody ScheduleJobDTO dto);

    /**
     * 任务删除
     * @param ids
     * @return
     */
    @DeleteMapping("job/schedule")
    Result delete(@RequestBody Long[] ids);

    /**
     * 立刻执行
     * @param ids
     * @return
     */
    @PutMapping("job/schedule/run")
    Result run(@RequestBody Long[] ids);

    /**
     * 暂停
     * @param ids
     * @return
     */

    @PutMapping("job/schedule/pause")
    Result pause(@RequestBody Long[] ids);

    /**
     * 重启
     * @param ids
     * @return
     */

    @PutMapping("job/schedule/resume")
    Result resume(@RequestBody Long[] ids);

}